home *** CD-ROM | disk | FTP | other *** search
-
- /*
- File: RDUtil.h
-
- Contains: QuickDraw GX to PostScript conversion code.
- This file contains definitions necessary for the Resource Dump Utilities.
-
- Version: Technology: Quickdraw GX 1.1.x
-
- Copyright: © 1995-1997 by Apple Computer, Inc., all rights reserved.
- */
-
- #ifndef __RESDUMPUTILS__
- #define __RESDUMPUTILS__
-
- #include <Types.h>
- #include "GXPrintingUniverse.h"
-
- //#include <NumberFormatting.h>
-
-
- typedef long TRDFlags;
-
- /** the eRDMakeHex flag is in the same bit position as eBuffMakeHex, this makes RD code better **/
-
- #define eRDnoOptions (TRDFlags)0x00L
- #define eRDMakeHex (TRDFlags)0x01L
- #define eRDCharSubs (TRDFlags)0x02L
- #define eRDNoAutoFlush (TRDFlags)0x04L
-
-
-
-
- #define kRDBufferSize 1024
-
- /*** The data structure for the Resource Dump Utility map record ***/
-
- typedef struct {
-
- CGXtoPostScriptDevice *psDevice; // Buffer Map for sending data. Allocated by GBAllocateBuffers;
-
- /* These parameters are used for caching resource information */
- Handle hLastResource; // Handle to the last resource loaded in by ResPrintf.
- short lastResID; // ID of last resource loaded in by ResPrintf.
- OSType lastResType; // type of the last resource loaded in by ResPrintf.
- short lastResRef; // Refnum of the resource file that the last resource was from.
- short lastResIndex; // Index of the last requested string in the resource.
- long lastOffset; // Byte offset into resource of the last requested string.
-
- /** These fields are for character substitution
- See block comment below for explination of substitution data structures **/
- short nSubs; // How many substitution specifications there are.
- Handle hCharSubstitute; // Handle to the string substitution array.
- unsigned char subsBits[32]; // substitution character bit array for speedy checking.
-
- /** Misc. fields **/
- char xySep; // Character to output between the x and y of a point.
-
- /** Buffering fields. **/
-
- short buffPtr;
- char buffer[kRDBufferSize];
-
- } TRDMapRec;
-
- typedef TRDMapRec *TRDMapPtr, **TRDMapHdl;
-
- /***************************************************
-
- The structure of the substitution array:
-
- The first byte is the character to substitute, the next byte is the
- length of the string to substitute it with, and then the substitution string
- itself, this pattern repeats for the number of substitutions.
-
- The substitution bits is an array of 256 bits. For each character
- that must be substituted, the bit with the index of the ascii value
- of the character is set in the array. This facilitates quick checking
- of characters to see if they need substitution. Then, only if they
- need it, we search the substitution array for the pascal-string to
- substitute it with.
-
- *****************************************************/
-
- /******
- This is the parameter block for RDResPrintf and its kin.
-
- *******/
-
- typedef struct {
-
- TRDMapHdl rdMap; // Client's map.
- OSType resType; // resource type to load
- short resID; // resource ID to load.
- short resIndex; // indexed string index into resource (used ony by resprintf)
- TRDFlags rdFlags; // Buffering flags.
-
- } TRDParams;
-
- /*************************** Externally referenced Function prototypes *************************/
-
- OSErr RDInit(CGXtoPostScriptDevice *psDevice, TRDMapHdl *rdMap);
- OSErr RDShutdown(TRDMapHdl rdMap);
- OSErr RDResPrintf(TRDParams *params, ...);
- OSErr RDResBDump(TRDParams *params);
- OSErr RDSetSubstitutions(TRDMapHdl rdMap, long nSubs, ...);
- OSErr RDResStrListDump(TRDParams *params, char *termString);
- OSErr RDSetXYSep(TRDMapHdl rdMap, char theChar);
- OSErr RDInvalResCache(TRDMapHdl rdMap);
- OSErr RDFlushBuffer(TRDMapHdl rdMap);
-
- #endif // __RESDUMPUTILS__
-